import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import 'package:amap_flutter_base/amap_flutter_base.dart';
import 'package:amap_flutter_map/amap_flutter_map.dart';
import 'package:hc_center/conf/AppConf.dart';
import 'dart:math';
import 'map_state.dart';

Widget buildView(MapState state, Dispatch dispatch, ViewService viewService) {
  final LatLng mapCenter = const LatLng(39.909187, 116.397451);
  final Map<String, Marker> _initMarkerMap = <String, Marker>{};

  for (int i = 0; i < 20; i++) {
    LatLng position = LatLng(mapCenter.latitude + sin(i * pi / 12.0) / 20.0,
        mapCenter.longitude + cos(i * pi / 12.0) / 20.0);
    Marker marker = Marker(position: position);
    _initMarkerMap[marker.id] = marker;
  }
  final AMapWidget amap = AMapWidget(
    apiKey: AppConf.amapApiKeys,
    markers: Set<Marker>.of(_initMarkerMap.values),
  );

  return Container(
    child: amap,
  );
}
